package com.gitee.chili.leisure.game;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;

/**
 * CardPlayer
 *
 * @author week solider
 * @since 2020-07-06
 */

@Data
@EqualsAndHashCode(callSuper = true)
public class PokerPlayer extends Player {

    /**
     * 是否抢过地主 (是:1 , 否:0)
     */
    private int doCatch;

    /**
     * 是否补枪地主 (是:1 , 否:0)
     */
    private int reCatch;

    /**
     * 剩余的牌
     */
    private int remainingCards;

    @Override
    public void draw0(Integer card) {
        if (handsCards == null) {
            synchronized (this) {
                if (handsCards == null) {
                    handsCards = new ArrayList<>(20);
                }
            }
        }
        handsCards.add(card);
    }

    @Override
    protected void discard0(Integer card) {
        if (discard == null) {
            synchronized (this) {
                if (discard == null) {
                    discard = new ArrayList<>(20);
                }
            }
        }
        discard.add(card);
    }

    @Override
    public Long getType() {
        return 2L;
    }
}
